@echo off
call setenv.bat

If "%JAVA_HOME%" == ""  goto javaHomeIsMissing
IF NOT EXIST "%JAVA_HOME%" goto javaHomeIsMissing

set CURRENT_DIR=%cd%
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%;%CURRENT_DIR%/lib/junit.jar;.;
set EXECUTEJAVA=java


IF NOT EXIST billingsystem.jar goto jarNotFound

echo Running App
cd %CURRENT_DIR% 
%EXECUTEJAVA% -classpath "billingsystem.jar;%CLASSPATH%" sg.edu.nus.iss.billing.ui.controller.OneBillingSystem
cd %CURRENT_DIR% 
pause

:javaHomeIsMissing
echo JAVA HOME NOT AVAILABLE , Please set the JAVA_HOME in setenv.bat
goto end

:jarNotFound
echo billingsystem.jar IS NOT AVAILABLE , PLEASE run compile.bat
:end
